import i18n from '@/i18n'
import store from "@/store";
import { watch } from "vue";
export function generateTitle(title) {
  return i18n.global.t('msg.route.' + title)
}

// watchSwitchLang方法在"5-32.方案落地：剩余问题处理"的04:40处讲起
// 监听语言的变化，主动触发校验，以便 `message` 属性的 `value` 进行重新获取
export function watchSwitchLang(...cbs) {
  watch(
    () => store.getters.language,
    () => {
      // console.log("当前语言：",store.getters.language,cbs);
      cbs.forEach(cb => cb(store.getters.language))
    }
  )
}